<?php

class openapi_api_params_v1_salesmaterial extends openapi_api_params_abstract implements openapi_api_params_interface{

    public function checkParams($method,$params,&$sub_msg){
        if(parent::checkParams($method,$params,$sub_msg)){
            return true;
        }else{
            return false;
        }
    }

    public function getAppParams($method){
        $params = array(
            'getList'=>array(
                'sales_material_bn'   => array('type' => 'string','name' => '销售物料编码'),
                'page_no'=>array('type'=>'number','required'=>'false','name'=>'页码','desc'=>'默认1,第一页'),
                'page_size'=>array('type'=>'number','required'=>'false','name'=>'每页数量','desc'=>'最大100'),
            ),
            'add'=>array(
                'sales_material_name'  => array('type'=>'string','required'=>'true','name'=>'销售物料名称','desc'=>'必填'),
                'sales_material_bn'   => array('type' => 'string','required'=>'true','name' => '销售物料编号','desc'=>'必填'),
                'sales_material_type'   => array('type' => 'number','required'=>'true','name' => '销售物料类型','desc'=>'必填，1代表普通类型、2代表促销类型、3代表赠品类型'),
                'unit'   => array('type' => 'string','name' => '计量单位'),
                'retail_price'   => array('type' => 'string','name' => '销售价'),
                //'cost'   => array('type' => 'string','name' => '成本价'),
                'bind_info'   => array('type' => 'string','name'=>'促销类关联物料信息','desc' => '单物料关联，例：test001；多物料关联，例子：test001:1x40|test002:2x60'),
            ),
            'edit'=>array(
                'sales_material_name'  => array('type'=>'string','required'=>'true','name'=>'销售物料名称','desc'=>'必填'),
                'sales_material_bn'   => array('type' => 'string','required'=>'true','name' => '销售物料编号','desc'=>'必填'),
                'sales_material_type'   => array('type' => 'number','required'=>'true','name' => '销售物料类型','desc'=>'必填，1代表普通类型、2代表促销类型、3代表赠品类型'),
                'unit'   => array('type' => 'string','name' => '计量单位'),
                'retail_price'   => array('type' => 'string','name' => '销售价'),
                //'cost'   => array('type' => 'string','name' => '成本价'),
                'bind_info'   => array('type' => 'string','name'=>'促销类关联物料信息','desc' => '单物料关联，例：test001；多物料关联，例子：test001:1x40|test002:2x60'),
            ),
        );

        return $params[$method];
    }

    public function description($method){
        $desccription = array(
            'getList'=>array(
                'name'        =>'销售物料查询接口',
                'description' =>'实时批量获取特定条件下的销售物料',
            ),
            'add'=>array(
                'name'        =>'销售物料添加接口',
                'description' =>'添加销售物料',
            ),
            'edit'=>array(
                'name'        =>'销售物料修改接口',
                'description' =>'修改销售物料',
            ),
        );
        return $desccription[$method];
    }
}